//
//  Book.m
//  17_SandBox
//
//  Created by dllo on 16/8/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "Book.h"

@implementation Book

// 取值,从本地获取
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
    if (self = [super init]) {
        _bookName = [aDecoder decodeObjectForKey:@"bookName"];
        _bookPrice = [aDecoder decodeObjectForKey:@"bookPrice"];
        _bookType = [aDecoder decodeObjectForKey:@"bookType"];
        _bookAuthor = [aDecoder decodeObjectForKey:@"bookAuthor"];
        _bookAddress = [aDecoder decodeObjectForKey:@"bookAddress"];
    }
    return self;
}

// 赋值
- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:_bookName forKey:@"bookName"];
    [aCoder encodeObject:_bookPrice forKey:@"bookPrice"];
    [aCoder encodeObject:_bookType forKey:@"bookType"];
    [aCoder encodeObject:_bookAuthor forKey:@"bookAuthor"];
    [aCoder encodeObject:_bookAddress forKey:@"bookAddress"];
}

@end
